Repository navigation
fix: upgrade treeland output protocol from v1 to v2 with UUID support [cherry-pick] - #1918
Conversation
… [cherry-pick] 1. 更新 CMakeLists 的 find_package 要求 TreelandProtocols 0.9 2. 迁移 treelandoutputwatcher 至 treeland_output_manager_v2 3. 迁移 treelandbrightness 从 color_control_v1 到 picture_control_v2 4. primary_output 事件回调从 wl_output* 改为 const QString &uuid 5. get_picture_control 请求从 wl_output* 改为 const QString &uuid 6. 新增 TreelandOutputUuidManager 和 TreelandOutputUuid 建立 wl_output→uuid 映射 7. 主屏匹配方式从指针比较改为 UUID 映射表查找 8. 补充 result 事件处理,含 commit_result 枚举(invalid_output=3) 9. 补充 primary_output_failed 事件处理 10. 缓存 pending primary uuid 处理时序问题 11. 处理屏幕移除并修复 TreelandOutputUuid 生命周期 12. 修复重复的 SPDX-FileCopyrightText 行 13. 更新 debian/control 构建依赖为 treeland-protocols (>= 0.9.0) 14. 提取 TreelandOutputUuidManager/TreelandOutputUuid 到共享头文件 shell/treelandoutputuuid.h,消除 shell 与 osd/brightness 模块间的重复定义 Log: 迁移 treeland output 协议消费者从 v1 到 v2 并适配 UUID 标识,提取共享 UUID 类消除重复代码 Influence: 多屏环境下主屏切换、OSD 亮度显示、屏幕热插拔 Ref: DDE-541 (cherry picked from commit f6363aa)
Reviewer's GuideAPIAdd shared UUID manager and UUID request classes so both the shell and brightness OSD can map a Wayland output to its protocol UUID.
Uses of the APIMigrate the output watcher to the v2 manager, resolve primary outputs through UUID mappings, and handle pending UUIDs, failed events, and screen removal.
Migrate brightness OSD output lookup to UUID-based v2 picture controls and handle brightness and invalid-output results.
ConfigurationRequire TreelandProtocols 0.9 and generate/link the v2 output-manager and UUID client protocol sources for the shell and brightness OSD.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="panels/notification/osd/brightness/treelandbrightness.cpp" line_range="129-130" />
<code_context>
m_control = nullptr;
- m_output = nullptr;
+ m_primaryScreen = nullptr;
+ delete m_uuidRequest;
+ m_uuidRequest = nullptr;
if (isInitialized()) {
destroy();
</code_context>
<issue_to_address>
**Event handling crashes the OSD**
When a UUID or picture-control proxy delivers its event, the callbacks synchronously delete the proxy whose event is being dispatched, which can invalidate the active Wayland callback and crash the OSD.
Defer proxy deletion until event dispatch has returned.
Also at `panels/notification/osd/brightness/treelandbrightness.cpp:141-143`.
</issue_to_address>
### Comment 2
<location path="shell/treelandoutputwatcher.cpp" line_range="18" />
<code_context>
+
TreelandOutputWatcher::TreelandOutputWatcher(QObject *parent)
- : QWaylandClientExtensionTemplate<TreelandOutputWatcher>(treeland_output_manager_v1_interface.version)
+ : QWaylandClientExtensionTemplate<TreelandOutputWatcher>(treeland_output_manager_v2_interface.version)
{
setParent(parent);
</code_context>
<issue_to_address>
**Older compositor loses output support**
When the updated shell or brightness module runs against a compositor that has not yet exposed v2, `TreelandOutputWatcher` and `TreelandBrightness` bind only the v2 manager, so a compositor that exposes only v1 leaves both extensions inactive. There is no v1 fallback, and primary-screen updates and OSD brightness stop working during a mixed-version rollout.
Coordinate deployment so the compositor exposes v2 before these consumers roll out, or retain a fallback for the old protocol during the transition.
Also at `panels/notification/osd/brightness/treelandbrightness.cpp:46`.
</issue_to_address>
### Comment 3
<location path="panels/notification/osd/brightness/treelandbrightness.cpp" line_range="141-143" />
<code_context>
TreelandBrightness::~TreelandBrightness()
{
delete m_control;
m_control = nullptr;
- m_output = nullptr;
</code_context>
<issue_to_address>
**Brightness stays stale after invalid output**
When the compositor reports `commit_result_invalid_output` while the primary screen remains unchanged, the handler deletes `m_control` and clears `m_currentUuid` without emitting `brightnessChanged` or requesting a replacement control, so the provider loses brightness and the applet keeps displaying its cached value until another refresh trigger.
Emit the brightness update and retry acquiring the UUID and picture control after invalid output.
</issue_to_address>
### Comment 4
<location path="shell/treelandoutputwatcher.cpp" line_range="63-65" />
<code_context>
+ if (!waylandScreen || !waylandScreen->output())
+ return;
+
+ auto *raw = m_uuidManager->get_uuid(waylandScreen->output());
+ if (!raw)
+ return;
+
+ auto *uuidObj = new TreelandOutputUuid(raw, this);
</code_context>
<issue_to_address>
**Failed requests remain unresolved**
When a UUID or picture-control request fails, or the compositor does not deliver a UUID response, `requestUuid`, `requestPrimaryUuid`, and the brightness path abandon the request without scheduling another attempt, leaving the pending primary unresolved or the OSD showing stale brightness until an unrelated screen or activation event triggers another attempt.
Schedule a retry or timeout when a UUID or picture-control request fails or does not complete.
Also at `panels/notification/osd/brightness/treelandbrightness.cpp:114-116`, `panels/notification/osd/brightness/treelandbrightness.cpp:132-134`.
</issue_to_address>| delete m_uuidRequest; | ||
| m_uuidRequest = nullptr; |
There was a problem hiding this comment.
🟠 High · Event handling crashes the OSD
When a UUID or picture-control proxy delivers its event, the callbacks synchronously delete the proxy whose event is being dispatched, which can invalidate the active Wayland callback and crash the OSD.
Defer proxy deletion until event dispatch has returned.
Also at panels/notification/osd/brightness/treelandbrightness.cpp:141-143.
Prompt for AI agents
In `panels/notification/osd/brightness/treelandbrightness.cpp` at lines 129-130:
**Event handling crashes the OSD**
When a UUID or picture-control proxy delivers its event, the callbacks synchronously delete the proxy whose event is being dispatched, which can invalidate the active Wayland callback and crash the OSD.
Defer proxy deletion until event dispatch has returned.
Also at `panels/notification/osd/brightness/treelandbrightness.cpp:141-143`.|
|
||
| TreelandOutputWatcher::TreelandOutputWatcher(QObject *parent) | ||
| : QWaylandClientExtensionTemplate<TreelandOutputWatcher>(treeland_output_manager_v1_interface.version) | ||
| : QWaylandClientExtensionTemplate<TreelandOutputWatcher>(treeland_output_manager_v2_interface.version) |
There was a problem hiding this comment.
🟡 Medium · Older compositor loses output support
When the updated shell or brightness module runs against a compositor that has not yet exposed v2, TreelandOutputWatcher and TreelandBrightness bind only the v2 manager, so a compositor that exposes only v1 leaves both extensions inactive. There is no v1 fallback, and primary-screen updates and OSD brightness stop working during a mixed-version rollout.
Coordinate deployment so the compositor exposes v2 before these consumers roll out, or retain a fallback for the old protocol during the transition.
Also at panels/notification/osd/brightness/treelandbrightness.cpp:46.
Prompt for AI agents
In `shell/treelandoutputwatcher.cpp` at line 18:
**Older compositor loses output support**
When the updated shell or brightness module runs against a compositor that has not yet exposed v2, `TreelandOutputWatcher` and `TreelandBrightness` bind only the v2 manager, so a compositor that exposes only v1 leaves both extensions inactive. There is no v1 fallback, and primary-screen updates and OSD brightness stop working during a mixed-version rollout.
Coordinate deployment so the compositor exposes v2 before these consumers roll out, or retain a fallback for the old protocol during the transition.
Also at `panels/notification/osd/brightness/treelandbrightness.cpp:46`.| delete m_control; | ||
| m_control = nullptr; | ||
| m_currentUuid.clear(); |
There was a problem hiding this comment.
🟡 Medium · Brightness stays stale after invalid output
When the compositor reports commit_result_invalid_output while the primary screen remains unchanged, the handler deletes m_control and clears m_currentUuid without emitting brightnessChanged or requesting a replacement control, so the provider loses brightness and the applet keeps displaying its cached value until another refresh trigger.
Emit the brightness update and retry acquiring the UUID and picture control after invalid output.
Prompt for AI agents
In `panels/notification/osd/brightness/treelandbrightness.cpp` at lines 141-143:
**Brightness stays stale after invalid output**
When the compositor reports `commit_result_invalid_output` while the primary screen remains unchanged, the handler deletes `m_control` and clears `m_currentUuid` without emitting `brightnessChanged` or requesting a replacement control, so the provider loses brightness and the applet keeps displaying its cached value until another refresh trigger.
Emit the brightness update and retry acquiring the UUID and picture control after invalid output.| auto *raw = m_uuidManager->get_uuid(waylandScreen->output()); | ||
| if (!raw) | ||
| return; |
There was a problem hiding this comment.
🟡 Medium · Failed requests remain unresolved
When a UUID or picture-control request fails, or the compositor does not deliver a UUID response, requestUuid, requestPrimaryUuid, and the brightness path abandon the request without scheduling another attempt, leaving the pending primary unresolved or the OSD showing stale brightness until an unrelated screen or activation event triggers another attempt.
Schedule a retry or timeout when a UUID or picture-control request fails or does not complete.
Also at panels/notification/osd/brightness/treelandbrightness.cpp:114-116, panels/notification/osd/brightness/treelandbrightness.cpp:132-134.
Prompt for AI agents
In `shell/treelandoutputwatcher.cpp` at lines 63-65:
**Failed requests remain unresolved**
When a UUID or picture-control request fails, or the compositor does not deliver a UUID response, `requestUuid`, `requestPrimaryUuid`, and the brightness path abandon the request without scheduling another attempt, leaving the pending primary unresolved or the OSD showing stale brightness until an unrelated screen or activation event triggers another attempt.
Schedule a retry or timeout when a UUID or picture-control request fails or does not complete.
Also at `panels/notification/osd/brightness/treelandbrightness.cpp:114-116`, `panels/notification/osd/brightness/treelandbrightness.cpp:132-134`.
|
2ade8d2
into
linuxdeepin:develop/2500u3
Cherry-pick commit f6363aa to develop/2500u3.
Source pull request #1729
Log: 迁移 treeland output 协议消费者从 v1 到 v2 并适配 UUID 标识,提取共享 UUID 类消除重复代码
Influence: 多屏环境下主屏切换、OSD 亮度显示、屏幕热插拔
Ref: DDE-541
Summary by Sourcery
Migrate Treeland output consumers to UUID-aware v2 protocols to support primary-display selection and brightness reporting across multi-monitor changes.
Bug Fixes:
Enhancements:
Build: